*Analyses

*Note: All variable coding appears below the Web Appendix analyses

*Files are located here:
**CCES
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/CCES13_UMI_OUTPUT.dta"
**2012 ANES
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/anes2012TS.dta"
**2008 ANES
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/anes2008TS.dta"
**1994 GSS
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/GSS1944.dta"

**2016 YouGov
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/YouGovSept2016.dta"

*Table 1: See Manuscript
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/CCES13_UMI_OUTPUT.dta"
set more off 
svyset [pweight=weight]

alpha racsymp1 racsymp2 racsymp3 racsymp4, gen(racesymp)

summarize racesymp if white==1 [aw=weight]

*Table 2: Factor Analysis. Source: CCES 
*first, 4-item racial sympathy scale
factor racsymp1 racsymp2 racsymp3 racsymp4 if white==1, pcf
rotate

*Factor Analysis with RR
factor racsymp1 racsymp2 racsymp3 racsymp4 irish generations tryharder deserve if white==1, pcf
rotate, promax

*Correlation of racial sympathy and racial resentment. Source: CCES
alpha irish generations tryharder deserve, gen(racialresentment)
corr racesymp racialresentment if white==1

*Figure 1: Distribution of Racial Sympathy and Racial Resentment
graph twoway (scatter racesymp4a raceresentment, jitter(20)) if white==1

*Table 3. Racial Sympathy and Support for Racialized Public Policies. Source: 2013 CCES
svy, subpop(if white==1): reg helpblack racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (Racial Sympathy and Policy Attitudes) ctitle(Govt. Aid to Blacks) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg welfare racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (Racial Sympathy and Policy Attitudes) ctitle(Welfare) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg blackbus racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (Racial Sympathy and Policy Attitudes) ctitle(Black Business) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg blackschool racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (Racial Sympathy and Policy Attitudes) ctitle(Black School) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg blackscholarship racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (Racial Sympathy and Policy Attitudes) ctitle(Black Scholarship) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg affact racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (Racial Sympathy and Policy Attitudes) ctitle(AffAct) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 4. Racial Sympathy and Support for Women's Policies. Source: 2013 CCES
reg abortion racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Abortion) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
reg abortion gensymp2 partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (The Influence of Gender Sympathy on Policy Support) ctitle(Abortion) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg womenleave racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Women's Leave) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg womenleave gensymp2 partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (The Influence of Gender Sympathy on Policy Support) ctitle(Women's Leave) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg womenaffact racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Affirmative Action for Women) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg womenaffact gensymp2 partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (The Influence of Gender Sympathy on Policy Support) ctitle(Affirmative Action for Women) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Figure 2: Racial Sympathy and Criminal Punishment, by Race of Culprit. Source: 2016 YouGov Study
use "/Users/jchudy/Google Drive/Research & Reviews/Article/JOP Final June 2019/Data/YouGovSept2016.dta"
svyset [pweight=weight]

svy: reg commservice whiteblackculprit##c.racialsympathy 
margins, at(racialsympathy=(0 1) whiteblackculprit=(0 1))
marginsplot

svy: reg commservice whiteblackculprit##c.racialsympathy whiteblackculprit##c.racialresentment
margins, at(racialsympathy=(0 1) whiteblackculprit=(0 1))
marginsplot


*****Web Appendix
**Web Appendix Table 1. Source CCES
tab racsymp1 if white==1 [aw=weight]
tab racsymp2 if white==1 [aw=weight]
tab racsymp3 if white==1 [aw=weight]
tab racsymp4 if white==1 [aw=weight]

**Web Appendix, Table 2. Source: CCES
reg racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin church region limitedgovt if white==1 [pweight=weight]
outreg2 using racesymp, title (Web Appendix - Table 2) ctitle(Racial Sympathy) alpha(0.001, 0.01, 0.05) symbol(***,**,*) bdec(2) nonotes lab excel replace
reg racialresentment partyid0to1 inc0to1 age0to1 educ0to1 genbin church region limitedgovt if white==1 [pweight=weight]
outreg2 using racesymp, title (Web Appendix - Table 2) ctitle(Racial Resentment) alpha(0.001, 0.01, 0.05) symbol(***,**,*) bdec(2) nonotes lab excel append

*Web Appendix, Tables 3-5

*Table 3 - Government Aid to Blacks
*Table 3: Racial Symapthy, Controls for Stereotypes, Egalitarianism, and Close to Blacks. Source: 2012 ANES 
svyset [pweight=weight_full]
svy, subpop(if white==1): reg govtaidblack sympblacks partyid0to1 limitedgovt raceres12 blackwhitelazy
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg govtaidblack sympblacks partyid0to1 limitedgovt raceres12 egalitarianism 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg govtaidblack sympblacks partyid0to1 limitedgovt raceres12 closeblack 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Closeblacks) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 3: Racial Sympathy, Controls for Egalitarianism and IAT. Source: 2008 ANES 
svyset [pweight=V080102]
svy, subpop(if white==1): reg govtaid sympblacks partyid0to1 limitedgovt racialresentment blackwhitelazy 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg govtaid sympblacks partyid0to1 limitedgovt racialresentment egalitarianism
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg govtaid sympblacks amp racialresentment partyid0to1 limitedgovt 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(IAT) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 3: Racial Sympathy, Controls for Egalitarianism and Contact with Blacks: Source: 1994 GSS
reg govtaid sympblacks partyid0to1 ideology raceres blackwhitelazy if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Govt Aid) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
reg govtaid sympblacks partyid0to1 ideology raceres govtincome if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Govt Aid) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg govtaid sympblacks partyid0to1 ideology raceres racdinner if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Govt Aid) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 4 - Affirmative Action
*Table 4: 2012 ANES, Racial Symapthy, Controls for Stereotypes, Egalitarianism, and Close to Blacks 
svyset [pweight=weight_full]
svy, subpop(if white==1): reg affacthire sympblacks partyid0to1 limitedgovt raceres12 blackwhitelazy
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg affacthire sympblacks partyid0to1 limitedgovt raceres12 egalitarianism 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg affacthire sympblacks partyid0to1 limitedgovt raceres12 closeblack 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Closeblacks) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 4: 2008 ANES, Racial Sympathy, Controls for Egalitarianism and IAT
svyset [pweight=V080102]
svy, subpop(if white==1): reg affacthire sympblacks partyid0to1 limitedgovt racialresentment blackwhitelazy 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg affacthire sympblacks partyid0to1 limitedgovt racialresentment egalitarianism
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg affacthire sympblacks amp racialresentment partyid0to1 limitedgovt 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(IAT) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 4: 1994 GSS, Racial Sympathy, Controls for Egalitarianism and Contact with Blacks
reg hiringpref sympblacks partyid0to1 ideology raceres blackwhitelazy if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
reg hiringpref sympblacks partyid0to1 ideology raceres govtincome if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg hiringpref sympblacks partyid0to1 ideology raceres racdinner if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Contact with Blacks) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 5 - Welfare
*Table 5: 2012 ANES, Racial Symapthy, Controls for Stereotypes, Egalitarianism, and Close to Blacks 
svyset [pweight=weight_full]
svy, subpop(if white==1): reg welfarelevel sympblacks partyid0to1 limitedgovt raceres12 blackwhitelazy
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg welfarelevel sympblacks partyid0to1 limitedgovt raceres12 egalitarianism 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg welfarelevel sympblacks partyid0to1 limitedgovt raceres12 closeblack 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Closeblacks) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 5: 2008 ANES, Racial Sympathy, Controls for Egalitarianism and IAT
svyset [pweight=V080102]
svy, subpop(if white==1): reg welfare sympblacks partyid0to1 limitedgovt racialresentment blackwhitelazy 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg welfare sympblacks partyid0to1 limitedgovt racialresentment egalitarianism
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg welfare sympblacks amp racialresentment partyid0to1 limitedgovt 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(IAT) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 5: 1994 GSS, Racial Sympathy, Controls for Egalitarianism and Contact with Blacks
reg welfare sympblacks partyid0to1 ideology raceres blackwhitelazy if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Stereotypes) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
reg welfare sympblacks partyid0to1 ideology raceres govtincome if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Egalitarianism) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg welfare sympblacks partyid0to1 ideology raceres racdinner if white==1
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Contact) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Table 6: 2012 ANES, Racial Sympathy, Personality and Support for Racialized Public Policies
svyset [pweight=weight_full]
svy, subpop(if white==1): reg govtaidblack sympblacks openopen agreewarm raceres12 partyid0to1 limitedgovt 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Govt Aid) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg affacthire sympblacks openopen agreewarm raceres12 partyid0to1 limitedgovt 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Affirmative Action) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg welfarelevel sympblacks openopen agreewarm raceres12 partyid0to1 limitedgovt 
outreg2 using sympblacks, title (Racial Sympathy and Policy Attitudes) ctitle(Welfare) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Web Appendix, Table 7: 2013 CCES: Racial Sympathy and Discriminant Validity
set more off 
svyset [pweight=weight]
reg envirojob racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Environment/Job Trade Off) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
reg pipeline racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Keystone Pipeline) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg borderpatrol racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Increase Border Patrols) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg denycit racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Deny automatic citizenship to U.S. born children) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
reg assaultr racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment if white==1 [pweight=weight]
outreg2 using racesymp, title (Racial Sympathy and Discriminant Validity) ctitle(Ban assault rifles) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*Web Appendix Table 8: 2013 CCES: Racial Sympathy and Support for Public Policies, Contingent on Race
set more off 

*Without Controls
svy, subpop(if white==1): reg bussub i.blackcondition##c.racesymp
outreg2 using racesymp, title (The Influence of Racial Sympathy on Poor Policies) ctitle(Business Subsidy) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg scholarshipsub i.blackcondition##c.racesymp 
outreg2 using racesymp, title (The Influence of Racial Sympathy on Poor Policies) ctitle(Scholarships) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg schoolsub i.blackcondition##c.racesymp
outreg2 using racesymp, title (The Influence of Racial Sympathy on Poor Policies) ctitle(Schools) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append

*With Controls
svy, subpop(if white==1): reg bussub i.blackcondition##c.racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (The Influence of Racial Sympathy on Poor Policies) ctitle(Business Subsidy) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel replace
svy, subpop(if white==1): reg scholarshipsub i.blackcondition##c.racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp, title (The Influence of Racial Sympathy on Poor Policies) ctitle(Scholarships) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append
svy, subpop(if white==1): reg schoolsub i.blackcondition##c.racesymp partyid0to1 inc0to1 age0to1 educ0to1 genbin region church limitedgovt racialresentment
outreg2 using racesymp4, title (The Influence of Racial Sympathy on Poor Policies) ctitle(Schools) alpha(0.01, 0.05, 0.10) symbol(***,**,*) bdec(2) nonotes lab excel append




***************************Variable Coding
*****2013 CCES

*Racial Sympathy
gen racsymp1=UMI411
recode racsymp1 8=.
recode racsymp1 1=1 2=.75 3=.5 4=.25 5=0
tab racsymp1 UMI411

gen racsymp2=UMI415
recode racsymp2 8=.
recode racsymp2 1=1 2=.75 3=.5 4=.25 5=0
tab racsymp2 UMI415

gen racsymp3=UMI418
recode racsymp3 8=.
recode racsymp3 1=1 2=.75 3=.5 4=.25 5=0
tab racsymp3 UMI418

gen racsymp4=UMI421
recode racsymp4 8=.
recode racsymp4 1=1 2=.75 3=.5 4=.25 5=0
tab racsymp4 UMI421

*Racial Resentment
gen irish=UMI426
recode irish 8=.
recode irish 1=1 2=.75 3=.5 4=.25 5=0
tab irish UMI426

gen generations=CC352
recode generations 8=.
recode generations 1=0 2=.25 3=.5 4=.75 5=1
tab generations CC352

gen tryharder=UMI428
recode tryharder 8=.
recode tryharder 1=0 2=.25 3=.5 4=.75 5=1
tab tryharder UMI428

gen deserve=CC353
recode deserve 8=.
recode deserve 1=1 2=.75 3=.5 4=.25 5=0
tab deserve CC353

gen white=.
replace white=1 if race==1
tab white

gen partyid=pid7
recode partyid 8=.
recode partyid 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen partyid0to1=partyid/6
tab partyid0to1 partyid

*Limited Government Index
gen lgbigproblems=UMI423
recode lgbigproblems 8=.
recode lgbigproblems 1=1 2=0
tab lgbigproblems

gen lgfreemarket=UMI424
recode lgfreemarket 8=.
recode lgfreemarket 1=0 2=1
tab lgfreemarket

gen lgless=UMI425
recode lgless 8=.
recode lgless 1=1 2=0
tab lgless

alpha lgbigproblems lgfreemarket lgless, gen(limitedgovt)

gen education=educ
recode education 1=0 2=1 3=2 4=3 5=4 6=5
gen educ0to1=education/5
tab educ0to1 education

gen genbin=gender
recode genbin 1=0 2=1
tab genbin gender

gen age=birthyr
gen age1=(2014-age)
gen age0to1=(age1-18)/72
tab age0to1

gen income=faminc
recode income 97=. 
gen inc0to1=(income-1)/15
tab inc0to1 faminc

gen region=inputstate
recode region 2/4=0 6/11=0 14/21=0 23/27=0 29/36=0 38/44=0 46=0 49/50=0
recode region 1=1 5=1 12=1 13=1 22=1 28=1 37=1 45=1 47=1 48=1 51=1
recode region 53/56=.
label define regionlab 0 "NonSouth" 1 "South"
label values region regionlab
tab region

gen church5=pew_churatd
recode church5 7/8=.
gen church=(church5-1)/5
tab church

gen gendersymp1=UMI414
recode gendersymp1 8=.
recode gendersymp1 1=1 2=.75 3=.5 4=.25 5=0
tab gendersymp1

gen gendersymp2=UMI419
recode gendersymp2 8=.
recode gendersymp2 1=1 2=.75 3=.5 4=.25 5=0
tab gendersymp2

alpha gendersymp1 gendersymp2, gen (gensymp2)

*Dependent Variables
*Federal Spending on Welfare
gen welfare6=UMI430
recode welfare6 8=.
recode welfare6 1=6 2=5 3=4 4=3 5=2 6=1 7=0
gen welfare=welfare6/6
tab welfare UMI430

*Government Should Help Blacks
gen govthelpblk100=UMI433
recode govthelpblk100 997/998=.
gen revhelpblack=govthelpblk100/100
gen helpblack=1-revhelpblack

*Racial Inequality - Giving business special breaks for locating in Black neighborhood
gen blackbus=UMI404
recode blackbus 8/9=.
recode blackbus 1=1 2=.75 3=.5 4=.25 5=0
tab blackbus

*Racial Inequality - Spending more money on schools in black neighborhoods
gen blackschool=UMI405
recode blackschool 8/9=.
recode blackschool 1=1 2=.75 3=.5 4=.25 5=0
tab blackschool

*Racial Inequality - College scholarships for Black children who maintain good grades
gen blackscholarship=UMI406
recode blackscholarship 8/9=.
recode blackscholarship 1=1 2=.75 3=.5 4=.25 5=0
tab blackscholarship

*Income Inequality - Giving business special breaks for locating in poor neighborhood
gen poorbus=UMI401
recode poorbus 8/9=.
recode poorbus 1=1 2=.75 3=.5 4=.25 5=0
tab poorbus

*Income Inequality - Spending more money on schools in poor neighborhoods
gen poorschool=UMI402
recode poorschool 8/9=.
recode poorschool 1=1 2=.75 3=.5 4=.25 5=0
tab poorschool

*Income Inequality - College scholarships for poor children who maintain good grades
gen poorscholarship=UMI403
recode poorscholarship 8/9=.
recode poorscholarship 1=1 2=.75 3=.5 4=.25 5=0
tab poorscholarship

gen bussub=blackbus
replace bussub=poorbus if blackbus==.

gen schoolsub=blackschool
replace schoolsub=poorschool if blackschool==.

gen scholarshipsub=blackscholarship
replace scholarshipsub=poorscholarship if blackscholarship==.

gen blackcondition=0
replace blackcondition=1 if blackbus~=.|blackschool~=.|blackscholarship~=.
tab blackcondition

*Affirmative Action
gen affact=CC330
recode affact 8=.
recode affact 1=1 2=.67 3=.33 4=0
tab affact

*6 months unpaid leave for women
gen womenleave=UMI434
recode womenleave 8=.
recode womenleave 1=1 2=0
tab womenleave

*Childcare assistance
gen womenchildcare=UMI435
recode womenchildcare 8=.
recode womenchildcare 1=1 2=0
tab womenchildcare

*Women preferential treatment
gen womenaffact=UMI436
recode womenaffact 1=1 2=.75 3=.5 4=.25 5=0
tab womenaffact

*Abortion
gen abortion=CC327
recode abortion 8=.
recode abortion 4=1 3=.67 2=.33 1=0
tab abortion

*Environment/Job Trade Off
gen envirojob=CC328
recode envirojob 8=.
recode envirojob 1=1 2=.75 3=.5 4=.25 5=0
tab envirojob

*Keystone Pipeline
gen pipeline=CC332D
recode pipeline 8=.
recode pipeline 1=1 2=0
tab pipeline

*Increase Border Patrols
gen borderpatrol=CC326_2
recode borderpatrol 1=1 2=0
tab borderpatrol

*Deny automatic citizenship to U.S. born children
gen denycit=CC326_6
recode denycit 1=1 2=0
tab denycit

*Ban assault rifles
gen assaultr=CC13_320d
recode assaultr 8=.
recode assaultr 1=1 2=0
tab assaultr

*****2012 ANES
*Sympathy for blacks
gen sympblacks=racecasi_sympblacks
recode sympblacks -9/-6=. 1=1 2=.75 3=.5 4=.25 5=0
tab sympblacks

*Racial Resentment
gen rrirish=resent_workway
recode rrirish -9/-6=.
recode rrirish 1=1 2=.75 3=.5 4=.25 5=0
tab rrirish

gen rrgen=resent_slavery
recode rrgen -9/-6=.
recode rrgen 1=0 2=.25 3=.5 4=.75 5=1

gen rrdeserve=resent_deserve
recode rrdeserve -9/-6=.
recode rrdeserve 1=0 2=.25 3=.5 4=.75 5=1

gen rrtry=resent_try
recode rrtry -9/-6=.
recode rrtry 1=1 2=.75 3=.5 4=.25 5=0

alpha rrirish rrgen rrdeserve rrtry, gen(raceres12)
 
*PartyID
gen partyid6=pid_x
recode partyid6 -2=. 
recode partyid6 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen partyid0to1=partyid6/6
tab partyid0to1

*White
gen white=.
replace white=1 if dem_raceeth==1
tab white dem_raceeth, miss

*Limited Government
gen lgbigproblems=govrole_big
recode lgbigproblems -9/-6=.
recode lgbigproblems 1=1 2=0
tab lgbigproblems

gen lgfreemarket=govrole_market
recode lgfreemarket -9/-6=.
recode lgfreemarket 1=0 2=1
tab lgfreemarket

gen lgless=govrole_lessmore
recode lgless -9/-6=.
recode lgless 1=1 2=0
tab lgless

alpha lgbigproblems lgfreemarket lgless, gen(limitedgovt)

gen revlimitedgovt=1-limitedgovt

*Close to blacks
gen closeblack100=ftcasi_black
recode closeblack100 -9/-6=.
gen closeblack=closeblack100/100

*Egalitarianism
gen egal_1=egal_equal
recode egal_1 -9/-6=.
recode egal_1 1=1 2=.75 3=.5 4=.25 5=0
tab egal_1 egal_equal

gen egal_2=egal_toofar
recode egal_2 -9/-6=.
recode egal_2 1=0 2=.25 3=.5 4=.75 5=1
tab egal_2 egal_toofar

gen egal_3=egal_bigprob
recode egal_3 -9/-6=.
recode egal_3 1=1 2=.75 3=.5 4=.25 5=0
tab egal_3 egal_bigprob

gen egal_4=egal_worryless
recode egal_4 -9/-6=.
recode egal_4 1=0 2=.25 3=.5 4=.75 5=1
tab egal_4 egal_worryless

gen egal_5=egal_notbigprob
recode egal_5 -9/-6=.
recode egal_5 1=0 2=.25 3=.5 4=.75 5=1
tab egal_5 egal_worryless

gen egal_6=egal_fewerprobs
recode egal_6 -9/-6=.
recode egal_6 1=1 2=.75 3=.5 4=.25 5=0
tab egal_6 egal_fewerprobs

alpha egal_1 egal_2 egal_3 egal_4 egal_5 egal_6, gen(egalitarianism) item

*Negative stereotypes
*Blacks Hardworking
gen blacklazy6=stype_hwkblack
recode blacklazy6 -9/-6=. 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen blacklazy=blacklazy6/6

*Whites Hardworking
gen whitelazy6=stype_hwkwhite
recode whitelazy6 -9/-6=. 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen whitelazy=whitelazy6/6

gen blackwhitelazy=(blacklazy-whitelazy+1)/2
gen revstereo=1-blackwhitelazy

*Personality
gen openopen7=tipi_open
recode openopen7 -9/-6=.
recode openopen7 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen openopen=openopen7/6
tab openopen

gen agreewarm7=tipi_warm
recode agreewarm7 -9/-6=.
recode agreewarm7 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen agreewarm=agreewarm7/6
tab agreewarm

**Dependent Variables

*Aid to blacks
gen govtaidblack6=aidblack_self
recode govtaidblack6 -9/-2=.
recode govtaidblack6 7=0 6=1 5=2 4=3 3=4 2=5 1=6
gen govtaidblack=govtaidblack6/6
tab govtaidblack

*Affirmative Action in hiring
gen affacthire=aapost_hire_x
recode affacthire -9/-1=.
recode affacthire 1=1 2=.67 4=.33 5=0 
tab affacthire

*Welfare
gen welfarelevel=cses_expwelf
recode welfarelevel -9/-6=.
recode welfarelevel 1=1 2=.75 3=.5 4=.25 5=0
tab welfarelevel cses_expwelf

*****2008 ANES
gen sympblacks=V085115
recode sympblacks -9/-2=.
recode sympblacks 1=1 2=.67 3=.33 4=0
tab sympblacks

gen partyid6=V083098x
recode partyid6 -1=.
gen partyid0to1=partyid6/6
tab partyid0to1

*Forming limited government
gen limitedgovt1=V085105
recode limitedgovt1 -9/-2=.
recode limitedgovt1 1=1 2=0
tab limitedgovt1

gen limitedgovt2=V085106
recode limitedgovt2 -9/-2=.
recode limitedgovt2 1=0 2=1
tab limitedgovt2

gen limitedgovt3=V085107
recode limitedgovt3 -9/-2=.
recode limitedgovt3 1=1 2=0
tab limitedgovt3

alpha limitedgovt1 limitedgovt2 limitedgovt3, gen(limitedgovt)

gen irish=V085143
recode irish -9/-2=.
recode irish 1=1 2=.75 3=.5 4=.25 5=0
tab irish

gen generations=V085144
recode generations -9/-2=.
recode generations 1=0 2=.25 3=.5 4=.75 5=1
tab generations
 
gen deserve=V085145
recode deserve -9/-2=.
recode deserve 1=0 2=.25 3=.5 4=.75 5=1
tab deserve

gen tryharder=V085146
recode tryharder -9/-2=.
recode tryharder 1=1 2=.75 3=.5 4=.25 5=0
tab tryharder

alpha irish generations deserve tryharder, gen(racialresentment)
gen revraceres=1-racialresentment

gen white=V081102
recode white -9/-4=.
recode white 1=1 2/7=0
tab white

*Black/white stereotypes
gen blacklazy6=V083207b
recode blacklazy6 -9/-8=.
gen blacklazy=((blacklazy6-1)/6)
tab blacklazy

gen whitelazy6=V083207a
recode whitelazy6 -9/-8=.
gen whitelazy=((whitelazy6-1)/6)
tab whitelazy

gen blackwhitelazy=(blacklazy-whitelazy+1)/2

*Egalitarianism 
gen egal_1=V085162
recode egal_1 -9/-2=.
recode egal_1 1=1 2=.75 3=.5 4=.25 5=0
tab egal_1 V085162

gen egal_2=V085163
recode egal_2 -9/-2=.
recode egal_2 1=0 2=.25 3=.5 4=.75 5=1
tab egal_2 V085163

gen egal_3=V085164
recode egal_3 -9/-2=.
recode egal_3 1=1 2=.75 3=.5 4=.25 5=0
tab egal_3 V085164

gen egal_4=V085165
recode egal_4 -9/-2=.
recode egal_4 1=0 2=.25 3=.5 4=.75 5=1
tab egal_4 V085165

gen egal_5=V085166
recode egal_5 -9/-2=.
recode egal_5 1=0 2=.25 3=.5 4=.75 5=1
tab egal_5 V085166

gen egal_6=V085167
recode egal_6 -9/-2=.
recode egal_6 1=1 2=.75 3=.5 4=.25 5=0
tab egal_6 V085167

alpha egal_1 egal_2 egal_3 egal_4 egal_5 egal_6, gen(egalitarianism) item

*AMP Coding
gen black1=V085311
recode black1 0=0 1=1 else=.
gen black1miss=V085311
recode black1miss . -5 -4=1 else=0
gen black2= V085312
recode black2 0=0 1=1 else=.
gen black2miss=V085312
recode black2miss . -5 -4=1 else=0
gen black3= V085313
recode black3 0=0 1=1 else=.
gen black3miss=V085313
recode black3miss . -5 -4=1 else=0
gen black4= V085314
recode black4 0=0 1=1 else=.
gen black4miss=V085314
recode black4miss . -5 -4=1 else=0
gen black5= V085315
recode black5 0=0 1=1 else=.
gen black5miss=V085315
recode black5miss . -5 -4=1 else=0
gen black6= V085316
recode black6 0=0 1=1 else=.
gen black6miss=V085316
recode black6miss . -5 -4=1 else=0
gen black7= V085317
recode black7 0=0 1=1 else=.
gen black7miss=V085317
recode black7miss . -5 -4=1 else=0
gen black8= V085318
recode black8 0=0 1=1 else=.
gen black8miss=V085318
recode black8miss . -5 -4=1 else=0
gen black9= V085319
recode black9 0=0 1=1 else=.
gen black9miss=V085319
recode black9miss . -5 -4=1 else=0
gen black10= V085320
recode black10 0=0 1=1 else=.
gen black10miss=V085320
recode black10miss . -5 -4=1 else=0
gen black11= V085321
recode black11 0=0 1=1 else=.
gen black11miss=V085321
recode black11miss . -5 -4=1 else=0
gen black12= V085322
recode black12 0=0 1=1 else=.
gen black12miss=V085322
recode black12miss . -5 -4=1 else=0
gen black13= V085323
recode black13 0=0 1=1 else=.
gen black13miss=V085323
recode black13miss . -5 -4=1 else=0
gen black14= V085324
recode black14 0=0 1=1 else=.
gen black14miss=V085324
recode black14miss . -5 -4=1 else=0
gen black15= V085325
recode black15 0=0 1=1 else=.
gen black15miss=V085325
recode black15miss . -5 -4=1 else=0
gen black16= V085326
recode black16 0=0 1=1 else=.
gen black16miss=V085326
recode black16miss . -5 -4=1 else=0
gen black17= V085327
recode black17 0=0 1=1 else=.
gen black17miss=V085327
recode black17miss . -5 -4=1 else=0
gen black18= V085328
recode black18 0=0 1=1 else=.
gen black18miss=V085328
recode black18miss . -5 -4=1 else=0
gen black19= V085329
recode black19 0=0 1=1 else=.
gen black19miss=V085329
recode black19miss . -5 -4=1 else=0
gen black20= V085330
recode black20 0=0 1=1 else=.
gen black20miss=V085330
recode black20miss . -5 -4=1 else=0
gen black21= V085331
recode black21 0=0 1=1 else=.
gen black21miss=V085331
recode black21miss . -5 -4=1 else=0
gen black22= V085332
recode black22 0=0 1=1 else=.
gen black22miss=V085332
recode black22miss . -5 -4=1 else=0
gen black23= V085333
recode black23 0=0 1=1 else=.
gen black23miss=V085333
recode black23miss . -5 -4=1 else=0
gen black24= V085334
recode black24 0=0 1=1 else=.
gen black24miss=V085334
recode black24miss . -5 -4=1 else=0
gen blackmiss=(black1miss+black2miss+black3miss+black4miss+black5miss+black6miss+black7miss+black8miss+black9miss+black10miss+black11miss+black12miss+black13miss+black14miss+black15miss+black16miss+black17miss+black18miss+black19miss+black20miss+black21miss+black22miss+black23miss+black24miss)

gen white1= V085335
recode white1 0=0 1=1 else=.
gen white1miss=V085335
recode white1miss . -5 -4=1 else=0
gen white2= V085336
recode white2 0=0 1=1 else=.
gen white2miss=V085336
recode white2miss . -5 -4=1 else=0
gen white3= V085337
recode white3 0=0 1=1 else=.
gen white3miss=V085337
recode white3miss . -5 -4=1 else=0
gen white4= V085338
recode white4 0=0 1=1 else=.
gen white4miss=V085338
recode white4miss . -5 -4=1 else=0
gen white5= V085339
recode white5 0=0 1=1 else=.
gen white5miss=V085339
recode white5miss . -5 -4=1 else=0
gen white6= V085340
recode white6 0=0 1=1 else=.
gen white6miss=V085340
recode white6miss . -5 -4=1 else=0
gen white7= V085341
recode white7 0=0 1=1 else=.
gen white7miss=V085341
recode white7miss . -5 -4=1 else=0
gen white8= V085342
recode white8 0=0 1=1 else=.
gen white8miss=V085342
recode white8miss . -5 -4=1 else=0
gen white9= V085343
recode white9 0=0 1=1 else=.
gen white9miss=V085343
recode white9miss . -5 -4=1 else=0
gen white10= V085344
recode white10 0=0 1=1 else=.
gen white10miss=V085344
recode white10miss . -5 -4=1 else=0
gen white11= V085345
recode white11 0=0 1=1 else=.
gen white11miss=V085345
recode white11miss . -5 -4=1 else=0
gen white12= V085346
recode white12 0=0 1=1 else=.
gen white12miss=V085346
recode white12miss . -5 -4=1 else=0
gen white13= V085347
recode white13 0=0 1=1 else=.
gen white13miss=V085347
recode white13miss . -5 -4=1 else=0
gen white14= V085348
recode white14 0=0 1=1 else=.
gen white14miss=V085348
recode white14miss . -5 -4=1 else=0
gen white15= V085349
recode white15 0=0 1=1 else=.
gen white15miss=V085349
recode white15miss . -5 -4=1 else=0
gen white16= V085350
recode white16 0=0 1=1 else=.
gen white16miss=V085350
recode white16miss . -5 -4=1 else=0
gen white17= V085351
recode white17 0=0 1=1 else=.
gen white17miss=V085351
recode white17miss . -5 -4=1 else=0
gen white18= V085352
recode white18 0=0 1=1 else=.
gen white18miss=V085352
recode white18miss . -5 -4=1 else=0
gen white19= V085353
recode white19 0=0 1=1 else=.
gen white19miss=V085353
recode white19miss . -5 -4=1 else=0
gen white20= V085354
recode white20 0=0 1=1 else=.
gen white20miss=V085354
recode white20miss . -5 -4=1 else=0
gen white21= V085355
recode white21 0=0 1=1 else=.
gen white21miss=V085355
recode white21miss . -5 -4=1 else=0
gen white22= V085356
recode white22 0=0 1=1 else=.
gen white22miss=V085356
recode white22miss . -5 -4=1 else=0
gen white23= V085357
recode white23 0=0 1=1 else=.
gen white23miss=V085357
recode white23miss . -5 -4=1 else=0
gen white24= V085358
recode white24 0=0 1=1 else=.
gen white24miss=V085358
recode white24miss . -5 -4=1 else=0
gen whitemiss=(white1miss+white2miss+white3miss+white4miss+white5miss+white6miss+white7miss+white8miss+white9miss+white10miss+white11miss+white12miss+white13miss+white14miss+white15miss+white16miss+white17miss+white18miss+white19miss+white20miss+white21miss+white22miss+white23miss+white24miss)

gen amp1=(1+white1-black1)/2
gen amp2=(1+white2-black2)/2
gen amp3=(1+white3-black3)/2
gen amp4=(1+white4-black4)/2
gen amp5=(1+white5-black5)/2
gen amp6=(1+white6-black6)/2
gen amp7=(1+white7-black7)/2
gen amp8=(1+white8-black8)/2
gen amp9=(1+white9-black9)/2
gen amp10=(1+white10-black10)/2
gen amp11=(1+white11-black11)/2
gen amp12=(1+white12-black12)/2
gen amp13=(1+white13-black13)/2
gen amp14=(1+white14-black14)/2
gen amp15=(1+white15-black15)/2
gen amp16=(1+white16-black16)/2
gen amp17=(1+white17-black17)/2
gen amp18=(1+white18-black18)/2
gen amp19=(1+white19-black19)/2
gen amp20=(1+white20-black20)/2
gen amp21=(1+white21-black21)/2
gen amp22=(1+white22-black22)/2
gen amp23=(1+white23-black23)/2
gen amp24=(1+white24-black24)/2

recode black1 .=0 if black1miss==1
recode black2 .=0 if black2miss==1
recode black3 .=0 if black3miss==1
recode black4 .=0 if black4miss==1
recode black5 .=0 if black5miss==1
recode black6 .=0 if black6miss==1
recode black7 .=0 if black7miss==1
recode black8 .=0 if black8miss==1
recode black9 .=0 if black9miss==1
recode black10 .=0 if black10miss==1
recode black11 .=0 if black11miss==1
recode black12 .=0 if black12miss==1
recode black13 .=0 if black13miss==1
recode black14 .=0 if black14miss==1
recode black15 .=0 if black15miss==1
recode black16 .=0 if black16miss==1
recode black17 .=0 if black17miss==1
recode black18 .=0 if black18miss==1
recode black19 .=0 if black19miss==1
recode black20 .=0 if black20miss==1
recode black21 .=0 if black21miss==1
recode black22 .=0 if black22miss==1
recode black23 .=0 if black23miss==1
recode black24 .=0 if black24miss==1

recode white1 .=0 if white1miss==1
recode white2 .=0 if white2miss==1
recode white3 .=0 if white3miss==1
recode white4 .=0 if white4miss==1
recode white5 .=0 if white5miss==1
recode white6 .=0 if white6miss==1
recode white7 .=0 if white7miss==1
recode white8 .=0 if white8miss==1
recode white9 .=0 if white9miss==1
recode white10 .=0 if white10miss==1
recode white11 .=0 if white11miss==1
recode white12 .=0 if white12miss==1
recode white13 .=0 if white13miss==1
recode white14 .=0 if white14miss==1
recode white15 .=0 if white15miss==1
recode white16 .=0 if white16miss==1
recode white17 .=0 if white17miss==1
recode white18 .=0 if white18miss==1
recode white19 .=0 if white19miss==1
recode white20 .=0 if white20miss==1
recode white21 .=0 if white21miss==1
recode white22 .=0 if white22miss==1
recode white23 .=0 if white23miss==1
recode white24 .=0 if white24miss==1

gen blacktotal=(black1+black2+black3+black4+black5+black6+black7+black8+black9+black10+black11+black12+black13+black14+black15+black16+black17+black18+black19+black20+black21+black22+black23+black24)/(24-blackmiss) if blackmiss<2
gen whitetotal=(white1+white2+white3+white4+white5+white6+white7+white8+white9+white10+white11+white12+white13+white14+white15+white16+white17+white18+white19+white20+white21+white22+white23+white24)/(24-whitemiss) if whitemiss<2
gen amp=(1+whitetotal-blacktotal)/2

*Dependent Variables
gen welfare7=V083145x
recode welfare7 -9/-8=.
recode welfare7 1=7 2=6 3=5 4=4 5=3 6=2 7=1 8=0
gen welfare=welfare7/7

gen govtaid6=V083137
recode govtaid6 -9/-7=.
recode govtaid6 1=6 2=5 3=4 4=3 5=2 6=1 7=0
gen govtaid=govtaid6/6

gen affact3=.
replace affact3=3 if V085157a==1
replace affact3=2 if V085157a==5
replace affact3=1 if V085157b==5
replace affact3=0 if V085157b==1
gen affacthire=affact3/3


*****1994 GSS Coding
gen white=race
recode white 1=1 2=0 3=0
tab white

gen sympblacks=symptblk
recode sympblacks 8/9=.
recode sympblacks 1=1 2=.67 3=.33 4=0
tab sympblacks

gen partyid6=partyid
recode partyid6 7/9=.
gen partyid0to1=partyid6/6

gen ideology6=polviews
recode ideology6 8/9=.
recode ideology6 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen ideology=ideology6/6
tab ideology

*Stereotypes
gen blacklazy6=workblks
recode blacklazy6 8/9=. 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen blacklazy=blacklazy6/6

*Whites Hardworking
gen whitelazy6=workwhts
recode whitelazy6 8/9=. 1=0 2=1 3=2 4=3 5=4 6=5 7=6
gen whitelazy=whitelazy6/6
gen blackwhitelazy=(blacklazy-whitelazy+1)/2

*Racial Resentment
gen deserve=blkgovt
recode deserve 8/9=.
recode deserve 5=1 4=.75 3=.5 2=.25 1=0
tab deserve

gen irish=immwrkup
recode irish 8/9=.
recode irish 5=1 4=.75 3=.5 2=.25 1=0
tab irish

alpha irish deserve, gen(raceres)
gen raceresentment=1-raceres


*Govt responsibilty to reduce differences in income - used as proxy for egalitarianism
gen govtincome=eqincome
recode govtincome 8/9=.
recode govtincome 1=0 2=.25 3=.5 4=.75 5=1
tab govtincome

*Contact
gen racdinner=rachome
recode racdinner 8/9=.
recode racdinner 1=1 2=0
tab racdinner

*Dependent Variables
gen welfare=natfare
recode welfare 8/9=.
recode welfare 1=1 2=.5 3=0
tab welfare

gen govtaid=natracey
recode govtaid 8/9=.
recode govtaid 1=1 2=.5 3=0
tab govtaid

gen hiringpref=affrmact
recode hiringpref 8/9=.
recode hiringpref 1=1 2=.67 3=.33 4=0
tab hiringpref


*****2016 YouGov
*this condition looks at the white culprit v. black culprit
gen whiteblackculprit=.
replace whiteblackculprit=1 if UMI407_410_treat_w2==1
replace whiteblackculprit=0 if UMI407_410_treat_w2==2


*Community Service
gen commservice7=UMI415_w2
recode commservice7 98/99=.
gen revcommservice=((commservice7-1)/7)
gen commservice=1-revcommservice
tab commservice

*Racial sympathy 

gen racesymp1=.
replace racesymp1=0 if UMI402_w1==2
replace racesymp1=.25 if UMI403_w1==4
replace racesymp1=.5 if UMI403_w1==3
replace racesymp1=.75 if UMI403_w1==2
replace racesymp1=1 if UMI403_w1==1
tab racesymp1

gen racesymp2=.
replace racesymp2=0 if UMI408_w1==2
replace racesymp2=.25 if UMI409_w1==4
replace racesymp2=.5 if UMI409_w1==3
replace racesymp2=.75 if UMI409_w1==2
replace racesymp2=1 if UMI409_w1==1
tab racesymp2

gen racesymp3=.
replace racesymp3=0 if UMI412_w1==2
replace racesymp3=.25 if UMI413_w1==4
replace racesymp3=.5 if UMI413_w1==3
replace racesymp3=.75 if UMI413_w1==2
replace racesymp3=1 if UMI413_w1==1
tab racesymp3 

gen racesymp4=.
replace racesymp4=0 if UMI417_w1==2
replace racesymp4=.25 if UMI418_w1==4
replace racesymp4=.5 if UMI418_w1==3
replace racesymp4=.75 if UMI418_w1==2
replace racesymp4=1 if UMI418_w1==1
tab racesymp4

alpha racesymp1 racesymp2 racesymp3 racesymp4, gen(racialsympathy)

*Racial Resentment
gen deserve=UMI426_w1
recode deserve 8/9=.
recode deserve 5=1 4=.75 3=.5 2=.25 1=0
tab deserve

gen irish=UMI427_w1
recode irish 8/9=.
recode irish 1=1 2=.75 3=.5 4=.25 5=0
tab irish

gen tryharder=UMI428_w1
recode tryharder 8/9=.
recode tryharder 1=1 2=.75 3=.5 4=.25 5=0
tab tryharder

gen generations=UMI429_w1
recode generations 8/9=.
recode generations 5=1 4=.75 3=.5 2=.25 1=0
tab generations

alpha deserve irish tryharder generations, gen(racialresentment)



